<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
	<title>钱包用户管理</title>
	 <%@ include file="/common/meta.jsp" %>
	<%@ include file="/common/import.jsp" %>
	<script type="text/javascript">
  $(function() {
	$('#list').datagrid({
		title:'钱包流水明细',
		url:'${ctx}/funds/admin/flowList.action?ff='+new Date().getTime(),
		striped: true,
		collapsible:false,				
		fitColumns: true,
		pagination:true,
		singleSelect:true,
		rownumbers:true,
		remoteSort: false,
		pageList:[10,15,20,30],
		idField : 'id',						
		columns : [ [
			{field : 'userid',title : '资金账号',align : 'left',width:50},
			{field : 'actionname',title : '操作描述',align : 'left',width:200},
			{field : 'actiontype',title : '操作类型',										align : 'left',width:60,
			       formatter : function(val,rec) {
			    	   if(val=='FINT')return val+'-充值';
			    	   if(val=='FOUT')return val+'-提现';
			    	   if(val=='PBOD')return val+'-冻结资金';
			    	   if(val=='FBDV')return val+'-冻结资金交割';
			    	   if(val=='FADV')return val+'-有效资金交割';
			    	   if(val=='CBOD')return val+'-解冻资金';
			    	   else return val;
					}
			},
			{field : 'direction',title : '操作金额',align : 'right',width:60,
			       formatter : function(val,rec) {
			    	   var str = '';
			    	   if(val=='in')str+='+';
			    	   if(val=='out')str+='-';
			    	   return str+=format((rec.amount/100).toFixed(2));
					}
			},
			{field : 'leaveamount',title : '剩余金额',align : 'center',width:100,
			       formatter : function(val,rec) {
			    	   var str = '';
			    	   return str+=format((val/100).toFixed(2));
					}},
			{field : 'createtime',title : '发生时间',align : 'center',width:100},
			{field : 'opacctid',title : '对手账号',align : 'left',width:60}
		] ]
	});
});
  function format(num){
		if(num == '' || num == undefined || num == null){
			return '--';
		}
		num = num.toString().replace(/\$|\,/g,'');  
	    if(isNaN(num))num = "0";  
	    sign = (num == (num = Math.abs(num)));  
	    num = Math.floor(num*100+0.50000000001);  
	    cents = num%100;  
	    num = Math.floor(num/100).toString();  
	    if(cents<10)  
	    cents = "0" + cents;  
	    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)  
	    num = num.substring(0,num.length-(4*i+3))+','+  
	    num.substring(num.length-(4*i+3));  
	    return (((sign)?'':'-') + num + '.' + cents); 
	} 
  function searchList(){
  	var queryParams = $('#list').datagrid('options').queryParams;	
  	//查询条件放到queryParams中：格式filter_params
      queryParams.userEname = $('#userEname').val();
      $('#list').datagrid("reload");
  }
  //清空查询条件   
  function clearForm(){   
    	$('#list'). datagrid('clearSelections');  
	    $('#queryForm')[0].reset();  
  }


</script>
</head>
<body class="home-template">
<!-- 正文开始 -->
<div class="easyui-panel" title="流水查询" collapsible="false">
<form id="queryForm" name="queryForm">
	<div style="padding-left:40">
	         资金账号： <input type="text" id="userEname" name="userEname" size="20" value="" maxlength="50" />
	    <a href="javascript:void(0);" onclick="searchList();" class="easyui-linkbutton" iconCls="icon-search">查询</a>
	    <a href="javascript:void(0);" onclick="clearForm();" class="easyui-linkbutton" iconCls="icon-search">清空</a>
	</div>
</form>
</div>

<table id="list"></table>

<!-- 正文结束 -->
</body>
</html>